﻿using MES.Core;
using MES.Model.System;

namespace MES.Service.System.UserRole
{
    public class UserRoleService : IUserRoleService
    {
        private readonly IDataBaseService _dataBaseService;
        public UserRoleService(IDataBaseService dataBaseService)
        {
            _dataBaseService = dataBaseService;
        }

        /// <summary>
        /// 添加角色权限
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public async Task<OperateResult> AddRolePermissionAsync(SyS_UserRole role)
        {
            var res = await _dataBaseService.sqlSugarClient.Insertable<SyS_UserRole>(role).ExecuteCommandAsync();

            if (res > 0)
            {
                return OperateResult.Success("添加成功");
            }
            else
            {
                return OperateResult.Fail("添加失败");
            }
        }
    }
}
